set (gwlib_SRC
    gw_login.cpp
    gw_dir.cpp
    gw_file.cpp
    gw_statfs.cpp
    gwlib.cpp)

add_library(gwlib SHARED ${gwlib_SRC})
add_library(gwlib_static_0 STATIC ${gwlib_SRC})

target_link_libraries(gwlib gwbase_static
    curl pthread uuid ssl jsoncpp_static sqlite3)

target_link_libraries(gwlib_static_0 gwbase_static
    curl pthread uuid ssl jsoncpp_static sqlite3)

merge_static_libs(gwlib_static
    gwlib_static_0 
    gwbase_static 
    jsoncpp_static)

add_executable(gwlib_tests gwlib_tests.cpp)
target_link_libraries(gwlib_tests gwlib_static_0 gwbase_static
    curl pthread uuid ssl jsoncpp_static crypto z sqlite3)

set (gwlib_HEADERS
    gw_login.h
    gw_dir.h
    gw_file.h
    gwlib.h)
install(FILES ${gwlib_HEADERS} DESTINATION include/gwlib)
install(FILES ../doc/how-to-run-gateway.md DESTINATION share/dicom)
install(FILES ../doc/how-to-run-hybrid-storage.txt DESTINATION share/dicom)
install(FILES ../doc/Gateway-API-Spec-v2.0.md DESTINATION share/dicom)

install(TARGETS gwlib DESTINATION lib)
install(TARGETS gwlib_static DESTINATION lib)
install(TARGETS gwlib_tests DESTINATION bin)
